package com.zmn.oms.zmn.business.interfaces.warranty;

import com.zmn.oms.common.exception.OmsBaseException;
import com.zmn.oms.model.dto.work.modify.OrderWarrantyDTO;
import com.zmn.oms.model.entity.work.OrderWork;
import com.zmn.oms.model.vo.warranty.WarrantyListOrderVO;
import com.zmn.oms.model.vo.warranty.WarrantyListUserVO;
import com.zmn.oms.model.vo.warranty.WarrantyUserVO;
import com.zmn.oms.model.vo.work.modify.ZsOrderWarrantyVO;

import java.util.List;
import java.util.Map;

/**
 * 类描述：保修卡
 *
 * @author heciqi
 * @date 2018/12/03 20:36
 */
public interface ZsOrderWarrantyBService {

	/**
	 * 查询订单保修卡信息
	 * @param orderId 订单Id
	 * @param workId 工单Id
	 * @return 保修信息
	 */
	ZsOrderWarrantyVO findOrderWarrantyVo(Long orderId, Long workId) throws OmsBaseException;

	/**
	 * 通过订单id查询保单信息
	 *
	 * @param orderId 订单id
	 * @return 保单信息
	 */
	WarrantyUserVO findWarrantyByOrderId(Long orderId);

    /**
     * 通过多个订单id，查询订单保单信息
     *
     * @param orderIdList 订单id集合
     * @return 保单信息
     */
    List<WarrantyListOrderVO> listWarrantyByOrderIdList(List<Long> orderIdList);

	/**
	 * 通过订单id和保修code查询保单信息
	 *
	 * @param orderId 订单id
	 * @param code    保修卡号
	 * @return 保单信息
	 */
	WarrantyUserVO findWarrantyDetailByOrderIdAndCode(Long orderId, String code);

	/**
	 * 根据用户id获取保修卡列表
	 *
	 * @param userId 用户id
	 * @return 保单信息
	 */
	List<WarrantyListUserVO> listWarrantyByUserId(Long userId);

	/**
	 * 激活保修卡
	 * @param orderId 订单id
	 * @return 激活结果
	 */
	void activeWarranty(Long orderId);

	/**
	 * 领取保修卡
	 *
	 * @param orderId 订单id
	 * @return 激活结果
	 */
	void takeWarranty(Long orderId,Long userId);

	/**
	 * 修改保修卡
	 * @param orderWarrantyDTO
	 */
	void updateWarranty(OrderWarrantyDTO orderWarrantyDTO) throws OmsBaseException;

	/**
	 * 删除保单项
	 * @param orderWarrantyDTO
	 */
	void deleteWarranty(OrderWarrantyDTO orderWarrantyDTO);

	/**
	 * 判断某一个产品是否存在保修项 <产品扩展proExtId , 是否存在保修项 1不存在 2存在>
	 * @param orderId
	 * @param workId
	 * @return
	 */
	Map<Long, Integer> isExistWarrantyInfoMap(Long orderId, Long workId);

	/**
	 * 返修单自动延保原单
	 *
	 * @param orderId
	 * @param workId
	 * @throws OmsBaseException
	 */
	void autoAddWarrantyDay(Long orderId, Long workId);

	/**
	 * 添加计价器3.0订单保修卡
	 *
	 * @param orderWork
	 * @param warrDTO
	 * @throws OmsBaseException
	 */
	void createQuotation3Warranty(OrderWork orderWork, OrderWarrantyDTO warrDTO);

	/**
	 * 删除保单信息
	 * @param orderId
	 */
	void deleteWarranty(Long orderId);
}
